package SmartHome;

import SmartHome.commands.CurtainCommand;
import SmartHome.commands.RemoteControl;
import SmartHome.devices.AirConditioner;
import SmartHome.devices.Curtain;
import SmartHome.handlers.AirConditionerHandler;
import SmartHome.handlers.VoiceHandler;
import SmartHome.observers.Sensor;

public class SmartHomeApplication {
    public static void main(String[] args) {
        AirConditioner airConditioner = new AirConditioner();
        Curtain curtain = new Curtain();

        //注册观察者
        Sensor sensor = new Sensor();
        sensor.registerObserver(airConditioner);
        //sensor.registerObserver(curtain);

        RemoteControl remoteControl = new RemoteControl(new CurtainCommand(curtain));
        //远程控制器绑定窗帘命令
        remoteControl.pressButton();
        remoteControl.pressUndo();

        VoiceHandler voiceHandler = new VoiceHandler();
        voiceHandler.setNextHandler(new AirConditionerHandler());
        //语音助手绑定空调命令
        voiceHandler.handleRequest("打开空调");
        sensor.detectTemperatureChange("温度下降");


    }
}
